<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Bartpl
 * @package App\Models\Application
 * @version July 17, 2018, 1:59 pm CST
 *
 * @property \App\Models\Application\PaneltplType paneltplType
 * @property string name
 * @property string title
 * @property string subtitle
 * @property string layout
 * @property integer paneltpl_type_id
 * @property string ui
 * @property string description
 */
class Bartpl extends Model
{
    use SoftDeletes;


    public $table = 'bartpls';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'name',
        'title',
        'subtitle',
        'layout',
        'paneltpl_type_id',
        'ui',
        'description'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'name' => 'string',
        'title' => 'string',
        'subtitle' => 'string',
        'layout' => 'string',
        'paneltpl_type_id' => 'integer',
        'ui' => 'string',
        'description' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'name' => 'required|max:100'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function paneltplType()
    {
        return $this->hasOne(\App\Models\Application\PaneltplType::class, 'id', 'paneltpl_type_id');
    }
}
